// theme_manager.cpp
#include "theme_manager.h"
#include <QPalette>
#include <QApplication>

ThemeManager::ThemeManager(QObject *parent) : QObject(parent) {}

void ThemeManager::applyDarkTheme(
    QGraphicsView *view,
    QListWidget *upList, QListWidget *downList,
    QListWidget *shoesList, QListWidget *dressList,
    QWidget *rightWidget)
{

    QPalette palette = qApp->palette();
    palette.setColor(QPalette::Window, QColor(53, 53, 53));
    palette.setColor(QPalette::WindowText, Qt::white);
    palette.setColor(QPalette::Base, QColor(25, 25, 25));
    palette.setColor(QPalette::AlternateBase, QColor(53, 53, 53));
    palette.setColor(QPalette::ToolTipBase, Qt::white);
    palette.setColor(QPalette::ToolTipText, Qt::white);
    palette.setColor(QPalette::Text, Qt::white);
    palette.setColor(QPalette::Button, QColor(53, 53, 53));
    palette.setColor(QPalette::ButtonText, Qt::white);
    palette.setColor(QPalette::BrightText, Qt::red);
    palette.setColor(QPalette::Link, QColor(42, 130, 218));
    palette.setColor(QPalette::Highlight, QColor(42, 130, 218));
    palette.setColor(QPalette::HighlightedText, Qt::black);
    qApp->setPalette(palette);

    // 视图样式
    view->setBackgroundBrush(QColor(53, 53, 53, 100));
    view->setStyleSheet("background: rgba(53, 53, 53, 100); border: 1px solid rgba(100, 100, 100, 150);");

    // 列表样式
    QString darkListStyle = "background-color: rgba(53, 53, 53, 100); border: 1px solid rgba(100, 100, 100, 150);";
    upList->setStyleSheet(darkListStyle);
    downList->setStyleSheet(darkListStyle);
    shoesList->setStyleSheet(darkListStyle);
    dressList->setStyleSheet(darkListStyle);

    // 右侧区域样式
    if (rightWidget)
    {
        rightWidget->setStyleSheet("background-color: rgba(53, 53, 53, 100); border: 1px solid rgba(100, 100, 100, 150);");
    }
}

void ThemeManager::applyLightTheme(
    QGraphicsView *view,
    QListWidget *upList, QListWidget *downList,
    QListWidget *shoesList, QListWidget *dressList,
    QWidget *rightWidget)
{

    qApp->setPalette(qApp->style()->standardPalette());

    // 视图样式
    view->setBackgroundBrush(Qt::transparent);
    view->setStyleSheet("background: transparent; border: 1px solid rgba(255, 255, 255, 100);");

    // 列表样式
    QString lightListStyle = "background-color: rgba(255, 255, 255, 50); border: 1px solid rgba(255, 255, 255, 100);";
    upList->setStyleSheet(lightListStyle);
    downList->setStyleSheet(lightListStyle);
    shoesList->setStyleSheet(lightListStyle);
    dressList->setStyleSheet(lightListStyle);

    // 右侧区域样式
    if (rightWidget)
    {
        rightWidget->setStyleSheet("background-color: rgba(255, 255, 255, 50); border: 1px solid rgba(255, 255, 255, 100);");
    }
}
